<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>会员中心--珍医网</title>
    [#include "inc_head.html"/]
    <script src="/static/fore/ajaxfileupload.js"></script>
</head>
<body>

[#include "inc_header.html"/]
[#include "inc_focus.html"/]
<div class="dhnav">当前位置：<a href="/" target="_blank">首页</a>&nbsp;&gt;&nbsp;<span class="col">会员中心</span></div>
<div class="main">
    <div class="l">
        <div class="box">
            <div class="tit"><h2 class="hico_l12"><a href="/my_goods.jspx">账号信息</a></h2></div>
            <div class="l_jfcon">
                <table width="100%" cellpadding="20" cellspacing="20" background="0">

                    <tr>
                        <td><span>上传头像</span></td>
                        <td>
                            <input id="fileToUpload" type="file" size="45" name="fileToUpload" class="input">
                            <img name="imgPreview" src="${userDetail.avatar!'_files/images/no_picture.jpg'}"
                                 height="200" width="160"/>
                            <button class="button" onclick="ajaxFileUpload();">上传</button>
                            <script type="text/javascript">
                                function ajaxFileUpload() {
                                    $.ajaxFileUpload({
                                        url: '/cmscp/core/upload_image.do',// servlet请求路径
                                        secureuri: false,
                                        fileElementId: 'fileToUpload',// 上传控件的id
                                        dataType: 'json',
                                        success: function (data, status) {
                                            if (data.fileUrl) {
                                                $("input[name='logo']").val(data.fileUrl);
                                                $("[name='imgPreview']").attr("src", data.fileUrl);
                                            }
                                        },
                                        error: function (data, status, e) {
                                            alert('上传出错');
                                        }
                                    });
                                }
                            </script>
                        </td>
                    </tr>
                </table>
                <form action="${ctx}/my/profile.jspx" method="post" name="profileForm">
                    <input type="hidden" name="userId" value="${user.id}"/>
                    <input type="hidden" name="logo" value="${userDetail.avatar!'_files/images/no_picture.jpg'}"/>
                    <input type="hidden" name="nextUrl" value="${ctx}/my.jspx"/>
                    <table width="100%" cellpadding="20" cellspacing="20" background="0">
                        <tr>
                            <td><span>修改昵称</span></td>
                            <td><input type="text" name="nickname" value="${user.nickName!}"/></td>
                        </tr>
                        <tr>
                            <td><span>修改密码</span></td>
                            <td><input type="password" name="password"/></td>
                        </tr>
                        <tr>
                            <td><span>确认密码</span></td>
                            <td><input type="password" name="password_repeate"/></td>
                        </tr>
                        <tr>
                            <td><span>医院名称</span></td>
                            <td><input type="text" name="hospital" value="${userDetail.hospital!}"/></td>
                        </tr>
                        <tr>
                            <td colspan="2" style="padding-left:230px;"><input type="button" onclick="submitAjax()"
                                                                               value="    修     改    "/></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>

        <!--<div class="box">-->
        <!--<div class="tit"><h2 class="hico_l15">游戏专区</h2></div>-->
        <!--<ul class="plist3">-->
        <!--<li><a href="#" target="_blank" ><img src="img/mpic01.jpg" alt="病例管理" width="190" height="105"/></a><a href="#" target="_blank" >游戏名称</a></li>-->
        <!--<li><a href="#" target="_blank" ><img src="img/mpic01.jpg" alt="病例管理" width="190" height="105"/></a><a href="#" target="_blank" >游戏名称</a></li>-->
        <!--<li><a href="#" target="_blank" ><img src="img/mpic01.jpg" alt="病例管理" width="190" height="105"/></a><a href="#" target="_blank" >游戏名称</a></li>-->
        <!--</ul>-->
        <!--</div>-->

    </div>
    <div class="r">
        [#include "sys_member_my_right.html" /]
    </div>
</div>

[#include "inc_fankui.html"/]
[#include "inc_footer.html"/]
<script type="text/javascript">
    function submitAjax() {
        var form = $("form[name='profileForm']");

        $.post('${ctx}/my/profile.jspx', form.serialize(), function (data) {
            alert(data.message);
            if (data.code > 0) {
                window.location.href = '/my.jspx';
            }
        });
    }
</script>
</body>
</html>

